// 现代化UI组件样式库
// 基于玻璃态、渐变、动效的现代设计系统

@use './variables.scss' as *;

// ==================== 现代化变量系统 ====================

// 现代化颜色系统
:root {
  // 主要渐变色
  --modern-gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --modern-gradient-secondary: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  --modern-gradient-accent: linear-gradient(90deg, #6366f1, #8b5cf6, #ec4899);
  --modern-gradient-success: linear-gradient(90deg, #10b981, #06b6d4, #3b82f6);
  
  // 玻璃态背景
  --modern-glass-bg: rgba(255, 255, 255, 0.95);
  --modern-glass-bg-light: rgba(255, 255, 255, 0.9);
  --modern-glass-bg-ultra-light: rgba(255, 255, 255, 0.7);
  --modern-glass-border: rgba(255, 255, 255, 0.2);
  --modern-glass-border-light: rgba(255, 255, 255, 0.3);
  
  // 现代化文字颜色
  --modern-text-primary: #0f172a;
  --modern-text-secondary: #1e293b;
  --modern-text-muted: #64748b;
  --modern-text-light: #94a3b8;
  
  // 现代化阴影系统
  --modern-shadow-sm: 0 8px 32px rgba(0, 0, 0, 0.08);
  --modern-shadow-md: 0 16px 40px rgba(0, 0, 0, 0.12);
  --modern-shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.15);
  --modern-shadow-xl: 0 32px 64px rgba(0, 0, 0, 0.15);
  
  // 现代化圆角
  --modern-radius-sm: 12px;
  --modern-radius-md: 16px;
  --modern-radius-lg: 20px;
  --modern-radius-xl: 24px;
  
  // 现代化动画
  --modern-transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --modern-transition-normal: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --modern-transition-slow: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  
  // 模糊效果
  --modern-blur-sm: blur(8px);
  --modern-blur-md: blur(16px);
  --modern-blur-lg: blur(20px);
}

// ==================== 基础组件 ====================

// 现代化页面容器
.modern-page {
  background: var(--modern-gradient-primary);
  min-height: 100vh;
  padding: 2rem;
  
  @media (max-width: $breakpoint-lg) {
    padding: 1.5rem;
  }
  
  @media (max-width: $breakpoint-sm) {
    padding: 1rem;
  }
  
  @media (max-width: $breakpoint-xs) {
    padding: 0.75rem;
  }
}

// 现代化卡片基础样式
.modern-card {
  background: var(--modern-glass-bg);
  backdrop-filter: var(--modern-blur-lg);
  border: 1px solid var(--modern-glass-border);
  border-radius: var(--modern-radius-lg);
  box-shadow: var(--modern-shadow-lg);
  transition: var(--modern-transition-normal);
  overflow: hidden;
  position: relative;
  
  &:hover {
    transform: translateY(-4px);
    box-shadow: var(--modern-shadow-xl);
  }
  
  // 卡片头部
  &__header {
    padding: 1.5rem 2rem 1.25rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(168, 85, 247, 0.05) 100%);
    border-radius: var(--modern-radius-lg) var(--modern-radius-lg) 0 0;
    
    h1, h2, h3, h4, h5, h6 {
      font-weight: 700;
      background: var(--modern-gradient-secondary);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
      margin: 0;
      letter-spacing: -0.025em;
    }
    
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.125rem; }
    h5 { font-size: 1rem; }
    h6 { font-size: 0.875rem; }
  }
  
  // 卡片内容
  &__content {
    padding: 1.5rem 2rem;
  }
  
  // 卡片尺寸变体
  &--sm {
    border-radius: var(--modern-radius-md);
    
    .modern-card__header {
      padding: 1rem 1.5rem;
      border-radius: var(--modern-radius-md) var(--modern-radius-md) 0 0;
    }
    
    .modern-card__content {
      padding: 1rem 1.5rem;
    }
  }
  
  &--lg {
    border-radius: var(--modern-radius-xl);
    
    .modern-card__header {
      padding: 2rem 2.5rem 1.5rem;
      border-radius: var(--modern-radius-xl) var(--modern-radius-xl) 0 0;
    }
    
    .modern-card__content {
      padding: 2rem 2.5rem;
    }
  }
}

// ==================== 交互式卡片 ====================

// 悬浮交互卡片
.modern-card-interactive {
  @extend .modern-card;
  cursor: pointer;
  transition: var(--modern-transition-slow);
  
  &:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--modern-shadow-xl);
  }
  
  // 顶部装饰条
  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--modern-gradient-accent);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: var(--modern-radius-lg) var(--modern-radius-lg) 0 0;
    z-index: 1;
  }
  
  &:hover::before {
    opacity: 1;
  }
}

// 模块卡片（用于功能模块展示）
.modern-module-card {
  @extend .modern-card-interactive;
  text-align: center;
  
  &__content {
    padding: 1.5rem 1.25rem;
    position: relative;
  }
  
  &__icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(168, 85, 247, 0.1) 100%);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--modern-transition-normal);
  }
  
  &:hover &__icon {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(168, 85, 247, 0.2) 100%);
    transform: scale(1.1);
  }
  
  &__title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--modern-text-secondary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
  }
  
  &__desc {
    font-size: 0.8125rem;
    color: var(--modern-text-muted);
    line-height: 1.5;
    font-weight: 400;
  }
}

// ==================== 统计卡片 ====================

.modern-stat-card {
  @extend .modern-card;
  text-align: left;
  position: relative;
  overflow: hidden;
  
  &__content {
    padding: 1.5rem;
    position: relative;
    
    // 顶部装饰条
    &::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      height: 3px;
      background: var(--modern-gradient-success);
      border-radius: var(--modern-radius-md) var(--modern-radius-md) 0 0;
    }
  }
  
  &__number {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--modern-text-primary) 0%, var(--modern-text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
  }
  
  &__label {
    font-size: 0.875rem;
    color: var(--modern-text-muted);
    margin-bottom: 0.75rem;
    font-weight: 500;
  }
  
  &__trend {
    font-size: 0.8125rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    width: fit-content;
    
    &--up {
      color: #059669;
      background: rgba(16, 185, 129, 0.1);
    }
    
    &--down {
      color: #dc2626;
      background: rgba(239, 68, 68, 0.1);
    }
    
    &--stable {
      color: #6b7280;
      background: rgba(107, 114, 128, 0.1);
    }
  }
}

// ==================== 状态卡片 ====================

.modern-status-card {
  @extend .modern-card;
  text-align: center;
  transition: var(--modern-transition-normal);
  position: relative;
  
  &__content {
    padding: 1.5rem 1.25rem;
    position: relative;
  }
  
  &__icon {
    font-size: 2rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(168, 85, 247, 0.1) 100%);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--modern-transition-normal);
  }
  
  &__name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--modern-text-secondary);
    margin-bottom: 0.75rem;
    letter-spacing: -0.025em;
  }
  
  // 激活状态
  &--active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(168, 85, 247, 0.1) 100%);
    border: 2px solid rgba(99, 102, 241, 0.3);
    
    .modern-status-card__icon {
      background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(168, 85, 247, 0.2) 100%);
    }
  }
  
  &:hover {
    transform: translateY(-4px);
    box-shadow: var(--modern-shadow-md);
  }
}

// ==================== 网格布局 ====================

.modern-grid {
  display: grid;
  gap: 2rem;
  
  // 响应式网格
  &--auto {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
  
  &--2 {
    grid-template-columns: repeat(2, 1fr);
    
    @media (max-width: $breakpoint-sm) {
      grid-template-columns: 1fr;
    }
  }
  
  &--3 {
    grid-template-columns: repeat(3, 1fr);
    
    @media (max-width: $breakpoint-md) {
      grid-template-columns: repeat(2, 1fr);
    }
    
    @media (max-width: $breakpoint-sm) {
      grid-template-columns: 1fr;
    }
  }
  
  &--4 {
    grid-template-columns: repeat(4, 1fr);
    
    @media (max-width: $breakpoint-lg) {
      grid-template-columns: repeat(3, 1fr);
    }
    
    @media (max-width: $breakpoint-md) {
      grid-template-columns: repeat(2, 1fr);
    }
    
    @media (max-width: $breakpoint-sm) {
      grid-template-columns: 1fr;
    }
  }
  
  // 间距变体
  &--gap-sm {
    gap: 1rem;
  }
  
  &--gap-lg {
    gap: 3rem;
    
    @media (max-width: $breakpoint-sm) {
      gap: 2rem;
    }
  }
}

// ==================== 现代化按钮增强 ====================

.modern-btn-enhance {
  position: relative;
  overflow: hidden;
  backdrop-filter: var(--modern-blur-sm);
  transition: var(--modern-transition-normal);
  
  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
  }
  
  &:hover::before {
    left: 100%;
  }
  
  &:hover {
    transform: translateY(-2px);
    box-shadow: var(--modern-shadow-md);
  }
}

// ==================== 动画关键帧 ====================

@keyframes modern-float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes modern-pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

@keyframes modern-slide-in {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

// ==================== 工具类 ====================

.modern-float {
  animation: modern-float 3s ease-in-out infinite;
}

.modern-pulse {
  animation: modern-pulse 2s ease-in-out infinite;
}

.modern-slide-in {
  animation: modern-slide-in 0.6s ease-out;
}

// 玻璃态工具类
.modern-glass {
  background: var(--modern-glass-bg);
  backdrop-filter: var(--modern-blur-lg);
  border: 1px solid var(--modern-glass-border);
}

.modern-glass-light {
  background: var(--modern-glass-bg-light);
  backdrop-filter: var(--modern-blur-md);
  border: 1px solid var(--modern-glass-border-light);
}

// 渐变文字
.modern-text-gradient {
  background: var(--modern-gradient-secondary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

// 现代化阴影工具类
.modern-shadow-sm { box-shadow: var(--modern-shadow-sm); }
.modern-shadow-md { box-shadow: var(--modern-shadow-md); }
.modern-shadow-lg { box-shadow: var(--modern-shadow-lg); }
.modern-shadow-xl { box-shadow: var(--modern-shadow-xl); }

// 现代化圆角工具类
.modern-rounded-sm { border-radius: var(--modern-radius-sm); }
.modern-rounded-md { border-radius: var(--modern-radius-md); }
.modern-rounded-lg { border-radius: var(--modern-radius-lg); }
.modern-rounded-xl { border-radius: var(--modern-radius-xl); } 